import { useRef } from "react"
export default function App() {
    const myRef = useRef<HTMLHeadingElement|null>(null)
    const handleClick = () => {
        if (myRef.current) {
            //通过ref操作原生dom
            myRef.current.style.background = 'skyblue'
        }
    }
    return (
        <>
            <h1>hello react</h1>
            <button onClick={handleClick}>change style</button>
            <h2 ref={myRef}>hello ref</h2>
        </>
    )
}